
import { createApp } from 'vue'
import { store } from './stores'
import { useFadeInObserver } from "./fadein"
import App from './App.vue'

// normalize.css
import "normalize.css/normalize.css";

// tailwindcss
import "./styles/tailwind.css";
import router from './router'

const app = createApp(App)

app.directive('fade-in', {
    created() { },
    beforeMount() { },
    mounted(el) {
        el.classList.add('fade-element');

        const cleanUpObserver = useFadeInObserver(el);
        el._cleanUpObserver = cleanUpObserver;
    },
    beforeUpdate(el) {
        el.classList.remove('fade-in');
        el.classList.add('fade-element');

        const cleanUpObserver = useFadeInObserver(el);
        el._cleanUpObserver = cleanUpObserver;
    }
});

app.use(router)
app.use(store)
app.mount('#app')
